package com.loeng.framework.websocket.config.sender;

import com.loeng.framework.websocket.core.sender.local.LocalWebSocketMessageSender;
import com.loeng.framework.websocket.core.session.WebSocketSessionManager;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;

/**
 * 本地消息发送者配置
 * @author loeng zhuo
 */
@AutoConfiguration
@ConditionalOnProperty(prefix = "loeng.websocket", name = "sender-type", havingValue = "local")
public class LocalWebSocketMessageSenderConfiguration {

    /**
     * 本地消息发送者
     * @param sessionManager 会话管理器
     * @return 本地消息发送者
     */
    @Bean
    public LocalWebSocketMessageSender localWebSocketMessageSender(WebSocketSessionManager sessionManager) {
        return new LocalWebSocketMessageSender(sessionManager);
    }

}
